﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EvidenceManagement.Data.Common;

namespace EvidenceManagement.Data
{
    public abstract class BaseDataAccessor
    {
        protected readonly IDataRepository dataRepository = null;
        protected readonly IDataObjectCommand dataObjectCommand = null;
                
        public BaseDataAccessor()
        {
        }

        public BaseDataAccessor(string connectionKey)
            :this()
        {
            dataRepository = DataRepositoryFactory.CreateRepository(connectionKey);
            dataObjectCommand = new DataObjectCommand(dataRepository);
        }
               

        public IDataRepository DataRepository
        {
            get { return dataRepository; }
        }

        public IDataObjectCommand DataObjectCommand
        {
            get { return dataObjectCommand; }
        }
    }
}
